package cn.chinaflame.pagodas.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import cn.chinaflame.pagodas.entity.PaProductPosition;

public interface PaProductPositionRepository extends JpaRepository<PaProductPosition, String>, JpaSpecificationExecutor<PaProductPosition> {

    @Query("select c from PaProductPosition c where c.positionNo = ?1 and c.areaId = ?2")
    public PaProductPosition findByNoAndAreaId(String positionNo, String areaId);
    
    @Query("select substring(c.name,1,2) from PaProductPosition c where c.state = 0 group by c.name")
    public List<String> loadProductPositions();
}
